<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的考试</title>
    <link rel="stylesheet" href="../../static/css/all.min.css">
    <!-- 引入 jQuery -->
    <script src="../../static/js/jquery.min.js"></script>
    <script src="../../static/js/jquery.cookie.min.js"></script>
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #3f37c9;
            --border-radius: 8px;
            --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            --border-color: #e0e0e0;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', sans-serif;
            background-color: #f5f7fa;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: var(--border-radius);
            box-shadow: var(--box-shadow);
            overflow: hidden;
        }

        /* 顶部操作栏（调整为下拉框） */
        .toolbar {
            padding: 20px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: flex-start;
            align-items: center;
            gap: 20px;
        }

        /* 筛选下拉框样式 */
        .filter-select {
            padding: 8px 16px;
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            background: white;
            cursor: pointer;
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 10px center;
            background-size: 16px;
            padding-right: 30px;
        }

        .filter-select option {
            background: white;
            color: #333;
        }

        .btn {
            padding: 10px 16px;
            border: none;
            border-radius: var(--border-radius);
            background-color: var(--primary-color);
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
        }

        .btn i {
            margin-right: 8px;
        }

        /* 考试卡片容器 */
        .exams-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            padding: 20px;
            border-bottom: 1px solid var(--border-color);
        }

        /* 考试卡片样式 - 固定占1/3宽度 */
        .exam-card {
            flex: 0 0 calc(33.333% - 20px);
            min-width: 280px;
            max-width: calc(33.333% - 20px);
            width: calc(33.333% - 20px);
            background: white;
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 15px;
            box-shadow: var(--box-shadow);
            transition: all 0.3s;
            overflow: hidden; /* 可选：防止内容撑开卡片 */
            cursor: pointer;
        }

        .exam-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
        }

        .exam-card h3 {
            margin-bottom: 8px;
            color: #2c3e50;
            font-size: 18px;
        }

        .exam-card p {
            margin-bottom: 5px;
            color: #6c757d;
            font-size: 14px;
        }

        .exam-status {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            color: white;
            font-size: 12px;
            margin-top: 8px;
        }

        .status-active {
            background-color: #28a745;
        }

        .status-inactive {
            background-color: #6c757d;
        }

        /* 分页器样式 */
        .pagination-container {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            padding: 20px;
            background: white;
            border-top: 1px solid var(--border-color);
            gap: 10px;
        }

        .pagination-controls {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .page-btn {
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            background: none;
            cursor: pointer;
            transition: all 0.2s;
        }

        .page-btn:hover {
            border-color: var(--primary-color);
            color: var(--primary-color);
        }

        .page-btn.active {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
            color: white;
        }

        .page-btn.disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .page-input {
            width: 60px;
            height: 36px;
            text-align: center;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            margin: 0 10px;
        }

        .page-size-selector {
            margin-left: 10px;
        }

        .page-size-select {
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 3px;
            background: #fff;
            cursor: pointer;
            outline: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 8px center;
            background-size: 16px;
            padding-right: 28px;
        }

        .change {
            width: 50px;
        }

        /* 弹出层样式 */
        .modal-mask {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: none; /* 默认隐藏 */
            justify-content: center;
            align-items: center;
            z-index: 9999;
        }

        .modal-dialog {
            width: 500px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            animation: fadeInUp 0.3s ease;
        }

        @keyframes fadeInUp {
            from {
                transform: translateY(20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid #e0e0e0;
            background-color: #f8f9fa;
        }

        .modal-title {
            margin: 0;
            font-size: 18px;
            color: #333;
        }

        .close-btn {
            font-size: 24px;
            color: #999;
            cursor: pointer;
            transition: color 0.2s;
        }
        .close-btn:hover {
            color: #666;
        }

        .modal-body {
            padding: 20px;
            color: #555;
            line-height: 1.8;
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            padding: 16px 20px;
            border-top: 1px solid #e0e0e0;
            background-color: #f8f9fa;
        }

        .enter-exam-btn:disabled {
            cursor: not-allowed;
            opacity: 0.7;
        }


        /* 考试卡片 - 分数显示 */
        .exam-card {
            /* 新增相对定位，让内部绝对定位的分数能基于卡片定位 */
            position: relative;
            /* 原有样式保持不变... */
        }

        /* 右上角分数容器 */
        .exam-score {
            position: absolute;       /* 基于 .exam-card 绝对定位 */
            top: 10px;               /* 距离顶部间距 */
            right: 15px;             /* 距离右侧间距 */
            background-color: #f8f9fa;
            color: #495057;
            font-size: 14px;
            padding: 4px 8px;
            border: 1px solid #e0e0e0;
            border-radius: 4px;
        }
    </style>
</head>
<body>
<div class="container">
    <!-- 顶部操作栏（含筛选下拉框） -->
    <div class="toolbar">
        <select class="filter-select" id="filterSelect">
            <option value="all">全部考试</option>
            <option value="teacher">教师发布</option>
            <option value="self">笔记自测</option>
            <option value="errorCollection">错题生成</option>
        </select>
    </div>

    <!-- 考试卡片容器 -->
    <div class="exams-container" id="examsContainer">
        <!-- 考试卡片将通过JS动态渲染 -->
    </div>

    <!-- 分页器 -->
    <div class="pagination-container">
        <div class="pagination-controls">
            <button class="page-btn first">
                <i class="fas fa-angle-double-left"></i>
            </button>
            <button class="page-btn front">
                <i class="fas fa-angle-left"></i>
            </button>
            <div class="page-number" style="display: flex">
                <!-- 分页按钮将通过JS动态渲染 -->
            </div>
            <button class="page-btn next">
                <i class="fas fa-angle-right"></i>
            </button>
            <button class="page-btn end">
                <i class="fas fa-angle-double-right"></i>
            </button>
        </div>
        <div class="page-size-selector">
            <select class="page-size-select">
                <option value="6">6条/页</option>
                <option value="9">9条/页</option>
                <option value="12">12条/页</option>
            </select>
        </div>
        <input type="number" class="page-input" placeholder="页码" min="1" step="1">
        <button class="page-btn change">跳转</button>
    </div>
</div>

<!-- 考试详情弹出层 -->
<div class="modal-mask" id="examModal">
    <div class="modal-dialog">
        <div class="modal-header">
            <h3 class="modal-title">考试详情</h3>
            <span class="close-btn" onclick="closeModal()">×</span>
        </div>
        <div class="modal-body">
            <p><strong>考试名称：</strong><span id="modalExamName"></span></p>
            <p><strong>发布时间：</strong><span id="modalCreatetime"></span></p>
            <p><strong>开始时间：</strong><span id="modalExamtime"></span></p>
            <p><strong>考试时长：</strong><span id="modalDuration"></span></p>
            <p><strong>状态：</strong><span id="modalStatus"></span></p>
            <p><strong>发布者：</strong><span id="modalCreator"></span></p>
        </div>
        <div class="modal-footer">
            <button class="btn enter-exam-btn" id="enterExamBtn">进入考试</button>
            <button class="btn" onclick="closeModal()">取消</button>
        </div>
    </div>
</div>

<!-- 引入JS文件 -->
<script src="../../static/js/my_exam.js"></script>
</body>
</html>
